package com.myidis.servlet;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myidis.entity.RightPermission;
import com.myidis.mapper.RightPermissionMapper;

@Service
public class RightPermissionServlet {
	@Autowired
	private RightPermissionMapper rightPermissionMapper;
	
	public List<RightPermission> all() {
		return rightPermissionMapper.all();
	}
	
	public RightPermission getOne(int id) {
		return rightPermissionMapper.getOne(id);
	}
	
	public int insert(RightPermission obj) {
		return rightPermissionMapper.insert(obj);
	}
	
	public int insertAll(List<RightPermission> objs) {
		int count = 0;
		for (RightPermission obj: objs) {
			System.out.println(obj.toString());
			count += rightPermissionMapper.insert(obj);
		}
		return count;
	}
	
	public int update (RightPermission obj) {
		return rightPermissionMapper.update(obj);
	}
	
	public int delete(int id) {
		return rightPermissionMapper.delete(id);
	}
	
	public int deleteAll(int[] ids) {
		int count = 0;
		for(int id: ids)
			count += rightPermissionMapper.delete(id);
		return count;
	}
}
